version 15.1

clear
use "worms_replication.dta"
set more off


*Create half Century Counters*
gen half_century = 50*floor(year/50)
label var half_century "Half Century"
quietly forval i = 3/18{
	gen HC`i'0 = 0
	gen HC`i'5 = 0
	replace HC`i'0 = 1 if year >= `i'*100 -50 & year <`i'*100
	replace HC`i'5 = 1 if year >= `i'*100 & year <`i'*100 + 50
	}

*Collapse to bishop-diocese and drop observations where bishop alignment not observed*
drop if byearin != year 
drop if religious_bishop == .

***draw historgram***
twoway ( ///
	hist half_century if covered ==1, ///
		fcolor(gs12%30) lcolor(gs8) gap(12) graphregion(color(white)) bgcolor(white) scheme(lean1) xlabel(300  500 700 900 1100 1300  ) ylab(, nogrid) disc freq ///
		) ///
		(hist half_century if covered ==0, ///
		fcolor(gs5%30) lcolor(gs8) gap(12)    disc freq ///
		), ///
		legend(order(1 "Covered" 2 "Uncovered"))
